package com.androidx.p013lv.invention.view;

import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.fragment.app.Fragment;
import com.alibaba.android.arouter.facade.Postcard;
import com.alibaba.android.arouter.launcher.ARouter;
import com.androidx.p013lv.base.Constance;
import com.androidx.p013lv.base.bean.InventionBean;
import com.androidx.p013lv.base.interfaces.Key;
import com.androidx.p013lv.base.p015ui.LazyFragment;
import com.androidx.p013lv.base.utils.LogUtils;
import com.androidx.p013lv.base.utils.UiUtils;
import com.androidx.p013lv.invention.C1069R;
import com.androidx.p013lv.invention.OnInventionType;
import com.androidx.p013lv.invention.adapter.VarietyAdapter;
import com.youth.banner.Banner;
import com.youth.banner.listener.OnBannerListener;
import com.youth.banner.listener.OnPageChangeListener;

/* renamed from: com.androidx.lv.invention.view.VarietyView */
public class VarietyView extends BaseView {
    VarietyAdapter adapter;
    Banner banner;
    LinearLayout btn_more;
    TextView tv_title;

    public VarietyView(View view, Fragment fragment, String str, OnInventionType onInventionType) {
        super(view, fragment, str, onInventionType);
        this.tv_title = (TextView) view.findViewById(C1069R.C1072id.tv_title);
        this.btn_more = (LinearLayout) view.findViewById(C1069R.C1072id.btn_more);
        this.banner = (Banner) view.findViewById(C1069R.C1072id.banner);
    }

    @Override // com.androidx.p013lv.invention.view.BaseView
    public void setView(InventionBean inventionBean, int i) {
        super.setView(inventionBean, i);
        this.tv_title.setText(this.inventionBean.getStationName());
        this.btn_more.setOnClickListener(new View.OnClickListener() {
            /* class com.androidx.p013lv.invention.view.VarietyView.View$OnClickListenerC12001 */

            public void onClick(View view) {
                VarietyView.this.onInventionType.onClick(VarietyView.this.inventionBean, VarietyView.this.position, view.getId());
            }
        });
        VarietyAdapter varietyAdapter = new VarietyAdapter(inventionBean.getVideoChoiceList(), this.domain, this.fragment);
        this.adapter = varietyAdapter;
        this.banner.setAdapter(varietyAdapter);
        this.banner.setBannerGalleryMZ(UiUtils.px2dp((UiUtils.getWindowWidth() - UiUtils.dp2px(200)) / 2), 0.88f);
        this.banner.addOnPageChangeListener(new OnPageChangeListener() {
            /* class com.androidx.p013lv.invention.view.VarietyView.C12012 */

            @Override // com.youth.banner.listener.OnPageChangeListener
            public void onPageScrollStateChanged(int i) {
            }

            @Override // com.youth.banner.listener.OnPageChangeListener
            public void onPageScrolled(int i, float f, int i2) {
            }

            @Override // com.youth.banner.listener.OnPageChangeListener
            public void onPageSelected(int i) {
                VarietyView.this.adapter.setSelectPosition(i);
            }
        });
        this.banner.setOnBannerListener(new OnBannerListener() {
            /* class com.androidx.p013lv.invention.view.VarietyView.C12023 */

            @Override // com.youth.banner.listener.OnBannerListener
            public void OnBannerClick(Object obj, int i) {
                LogUtils.m63e("--1-->", "" + VarietyView.this.banner.getCurrentItem());
                int i2 = i + 1;
                if (VarietyView.this.banner.getCurrentItem() != i2) {
                    LogUtils.m63e("--2-->", "" + i);
                    VarietyView.this.banner.setCurrentItem(i2);
                } else if (!((LazyFragment) VarietyView.this.fragment).isOnClick()) {
                    Postcard withString = ARouter.getInstance().build(Constance.VARIETY_INFO_ACTIVITY).withString(Key.TXT, VarietyView.this.adapter.getDataInPosition(i).getChoiceTitle()).withInt("type", VarietyView.this.adapter.getDataInPosition(i).getChoiceId()).withString(Key.DESC, VarietyView.this.adapter.getDataInPosition(i).getDesc());
                    withString.withString("data", VarietyView.this.adapter.getDomain() + VarietyView.this.adapter.getDataInPosition(i).getBackground()).navigation();
                }
            }
        });
    }
}
